<?php
/**
 * Created by PhpStorm.
 * User: hcadmin
 * Date: 16/7/20
 * Time: 下午3:00
 */
namespace app\models;

use Yii;
use yii\db\ActiveRecord;
class Attr extends ActiveRecord
{
    public function getCommodityAttributes($attr_id){
        $commodityAttributes = Attr::find()->where([
            'del_flag'=>1,
            'attr_id' => $attr_id,
        ])->asArray()->one();
        return $commodityAttributes;
    }

    //根据分类id获取属性列表
    public function getAttrList($category_id){
        $attrList = Attr::find()->where([
            'del_flag'=>1,
            'category_id' => $category_id,
        ])->asArray()->all();
        return $attrList;
    }


}